package net.wofly.cashier.preorder.validator;

import net.wofly.cashier.order.domain.Order;
import net.wofly.cashier.order.domain.OrderContent;
import net.wofly.cashier.order.util.OrderType;
import net.wofly.cashier.order.util.PayType;
import net.wofly.cashier.preorder.domain.BookMeal;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

import java.util.List;

public class BookMealValidator {
    
    /**
     * 换行符
     */
    private static String lineSeparator = System.getProperty("line.separator");
    
    public static String validateAddBookMealParam(BookMeal bookMeal) {
        StringBuffer stringBuffer = new StringBuffer();
        if (null == bookMeal) {
            stringBuffer.append("预定就餐实体不能为空").append(lineSeparator);
        } else {
            if (bookMeal.getAmount() == null || bookMeal.getAmount() <= 0) {
                stringBuffer.append("订单金额不能为空").append(lineSeparator);
            }

            if (bookMeal.getBookMealTime() == null) {
                stringBuffer.append("预定就餐时间不能为空").append(lineSeparator);
            }

            if (StringUtils.isEmpty(bookMeal.getCustomerUserID())) {
                stringBuffer.append("客户ID不能为空").append(lineSeparator);
            }

            if (StringUtils.isEmpty(bookMeal.getName())) {
                stringBuffer.append("预定人姓名不能为空！").append(lineSeparator);
            }

            if (StringUtils.isEmpty(bookMeal.getMobile())) {
                stringBuffer.append("预定人手机不能为空").append(lineSeparator);
            }

//            if (StringUtils.isEmpty(bookMeal.getTableID())) {
//                stringBuffer.append("餐桌ID不能为空").append(lineSeparator);
//            }

        }
        return stringBuffer.toString();
    }

    public static String validateCancelBookMealParam(String bookMealID, String customer) {
        StringBuffer stringBuffer = new StringBuffer();

        if (StringUtils.isEmpty(customer)) {
            stringBuffer.append("客户ID不能为空").append(lineSeparator);
        }

        if (StringUtils.isEmpty(bookMealID)) {
            stringBuffer.append("bookMealID不能为空").append(lineSeparator);
        }

        return stringBuffer.toString();
    }

    public static String validateGetAllBookMealParam(String employeeID, Long mealTime, Integer status) {
        StringBuffer stringBuffer = new StringBuffer();

        return stringBuffer.toString();
    }

    public static String validateGetMyBookMealParam(String customer, Long mealTime, Integer status) {
        StringBuffer stringBuffer = new StringBuffer();

        if (StringUtils.isEmpty(customer)) {
            stringBuffer.append("客户ID不能为空").append(lineSeparator);
        }

        return stringBuffer.toString();
    }

    public static String validateModifyMealTimeParam(String bookMealID, String customer, String name, String mobile, Long mealTime) {
        StringBuffer stringBuffer = new StringBuffer();

        if (StringUtils.isEmpty(customer)) {
            stringBuffer.append("客户ID不能为空").append(lineSeparator);
        }

        if (StringUtils.isEmpty(bookMealID)) {
            stringBuffer.append("bookMealID不能为空").append(lineSeparator);
        }

        if (StringUtils.isEmpty(name)) {
            stringBuffer.append("预定人姓名不能为空").append(lineSeparator);
        }

        if (StringUtils.isEmpty(mobile)) {
            stringBuffer.append("预定人手机不能为空").append(lineSeparator);
        }

        if (mealTime != null) {
            stringBuffer.append("预定就餐时间不能为空").append(lineSeparator);
        }

        return stringBuffer.toString();
    }

    public static String validatePayBookMealParam(String bookMealID, String customer, Double num) {
        StringBuffer stringBuffer = new StringBuffer();

        if (StringUtils.isEmpty(bookMealID)) {
            stringBuffer.append("bookMealID不能为空").append(lineSeparator);
        }

        if (StringUtils.isEmpty(customer)) {
            stringBuffer.append("客户ID不能为空").append(lineSeparator);
        }

        if (num != null) {
            stringBuffer.append("支付金额不能为空").append(lineSeparator);
        }

        return stringBuffer.toString();
    }

    public static String validateRepastParam(String bookMealID, String employeeID) {
        StringBuffer stringBuffer = new StringBuffer();

        if (StringUtils.isEmpty(bookMealID)) {
            stringBuffer.append("bookMealID不能为空").append(lineSeparator);
        }

//        if (StringUtils.isEmpty(employeeID)) {
//            stringBuffer.append("employeeID不能为空").append(lineSeparator);
//        }

        return stringBuffer.toString();
    }

    public static String validateVerifyCancelBookMealParam(String bookMealID, String employeeID) {
        StringBuffer stringBuffer = new StringBuffer();

        if (StringUtils.isEmpty(bookMealID)) {
            stringBuffer.append("bookMealID不能为空").append(lineSeparator);
        }

//        if (StringUtils.isEmpty(employeeID)) {
//            stringBuffer.append("employeeID不能为空").append(lineSeparator);
//        }

        return stringBuffer.toString();
    }
}
